home *** CD-ROM | disk | FTP | other *** search
-
-
-
- GETGRENT(3) MINTLIB LIBRARY FUNCTIONS GETGRENT(3)
-
-
- N✓NA✓AM✓ME✓E
- getgrent, getgrgid, getgrnam, setgrent, endgrent, fget-
- grent - get group file entry
-
- S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
- #include <stdio.h>
- #include <grp.h>
-
- struct group *getgrent(void);
-
- struct group *getgrgid(int gid);
-
- struct group *getgrnam(const char *name);
-
- void setgrent(void);
-
- void endgrent(void);
-
- struct group *fgetgrent(FILE *f);
-
- D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
- getgrent, getgrgid and getgrnam each returns a pointer to
- an object containing the broken-out fields of a line in
- the /etc/group file. Each line in the file contains a
- "group" structure, declared in the <grp.h> header file:
- struct group
- {
- char *gr_name; /* name of the group */
- char *gr_passwd; /* encrypted password */
- gid_t gr_gid; /* numerical group ID */
- char **gr_mem; /* array of member names */
- };
-
- getgrent when first called returns a pointer to the first
- group structure in the file; thereafter, it returns a
- pointer to the next group structure in the file; so suc-
- cessive calls can be used to search the entire file.
-
- getgrgid searches from the beginning of the file until a
- numerical group ID is found matching gid is found and
- returns a pointer to the particular structure in which it
- was found. Thus, it cannot be found to search for several
- groups having duplicate numerical group IDs.
-
- getgrnam searches from the beginning of the file until a
- group name matching name is found and returns a pointer to
- the particular structure in which it was found.
-
- If an EOF or an error is encountered on reading, getgrent,
- getgrgid and getgrnam return a NULL pointer.
-
- A call to setgrent has the effect of rewinding the group
- file to allow repeated searches.
-
-
-
-
- MiNT docs 0.1 3 March 1993 1
-
-
-
-
-
- GETGRENT(3) MINTLIB LIBRARY FUNCTIONS GETGRENT(3)
-
-
- endgrent may be called to close the group file when pro-
- cessing is complete.
-
- fgetgrent returns a pointer to the next group structure in
- the stream f, which matches the format of /etc/group.
-
- F✓FI✓IL✓LE✓ES✓S
- /etc/group
-
- S✓SE✓EE✓E A✓AL✓LS✓SO✓O
- g✓ge✓et✓tl✓lo✓og✓gi✓in✓n(✓(3✓3)✓),✓, g✓ge✓et✓tp✓pw✓we✓en✓nt✓t(✓(3✓3)✓)
-
- N✓NO✓OT✓TE✓ES✓S
- All information is contained in a static area, so it must
- be copied if it is to be saved.
-
- These routines cannot handle groups with over 128 members.
-
- These routines expect the group file to be of type text,
- and can therefore read both DOS and UN*X format files.
-
- fgetgrent is not standard, but is available on System V.
-
- For group files, there's no equivalent to putpwent.
-
- The password field of groups is seldom used.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MiNT docs 0.1 3 March 1993 2
-
-
-